package leetcode;

public class _0011 {
    /**
     * 盛最多水的容器
     */
    class Solution {
        public int maxArea(int[] height) {
            int n = height.length;
            int left =0;
            int right = n-1;
            int ans = 0;
            while(left<right){
                ans = (int)Math.max(ans,(right-left)*(int)Math.min(height[left],height[right]));
                if(height[left]<height[right]){
                    left++;
                }else{
                    right--;
                }
            }
            return ans;
        }
    }
}
